<template>
    <div>
        <el-row :gutter="20">
            <el-col :span="12">
                 <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <span><i class="el-icon-menu"></i> WAN--IP设置</span>
                    </div>
                    <div>
                        <el-form ref="wanForm" :model="wanForm"  :rules="rules"   label-width="80px">
                            <el-form-item label="IP地址" prop="ip">
                                <el-input v-model="wanForm.ip" placeholder="请输入IP地址(例如192.168.1.55)"  @blur="numBlur(1)"></el-input>
                            </el-form-item>
                            <el-form-item label="子网掩码"  prop="subnet">
                                <el-input v-model="wanForm.subnet"></el-input>
                            </el-form-item>
                            <el-form-item label="默认网关"  prop="gateway">
                                <el-input v-model="wanForm.gateway"></el-input>
                            </el-form-item>
                            <p class="zhushi">*网关与子网掩码默认会跟随IP地址的设置自动生成，若不符合需求可手动修改</p>
                            <el-form-item>
                                <el-button type="primary"   @click="saveWan()" style="width:90px;">保存</el-button>
                            </el-form-item>

                        </el-form>
                    </div>
                </el-card>
            </el-col>
           <el-col :span="12">
                 <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <span><i class="el-icon-menu"></i> LAN--IP设置</span>
                    </div>
                    <div>
                        <el-form ref="lanForm" :model="lanForm"  :rules="rules"   label-width="80px">
                            <el-form-item label="IP地址" prop="lanip">
                                <el-input v-model="lanForm.lanip" placeholder="请输入IP地址(例如192.168.1.55)"  @blur="numBlur(2)"></el-input>
                            </el-form-item>
                            <el-form-item label="子网掩码"  prop="lansubnet">
                                <el-input v-model="lanForm.lansubnet"></el-input>
                            </el-form-item>
                            <el-form-item label="默认网关"  prop="langateway">
                                <el-input v-model="lanForm.langateway"></el-input>
                            </el-form-item>
                            <p class="zhushi">*网关与子网掩码默认会跟随IP地址的设置自动生成，若不符合需求可手动修改</p>
                            <el-form-item>
                                <el-button type="primary"   @click="saveLan(0)" style="width:90px;">保存</el-button>
                            </el-form-item>

                        </el-form>
                    </div>
                </el-card>
            </el-col>
        </el-row>
        <el-row :gutter="20" style="margin-top:20px;">
            <el-col :span="12">
                 <el-card class="box-card" v-loading="loading"
                element-loading-text="拼命加载中"
                element-loading-spinner="el-icon-loading"
                element-loading-background="rgba(0, 0, 0, 0.6)" style="height:420px">
                    <div slot="header" class="clearfix" @click="offineClick()">
                        <span><i class="el-icon-menu"></i> 系统设置</span>
                    </div>
                    <div style="margin-bottom:25px;">
                        <el-input placeholder="请输入内容" v-model="systemName"  maxlength="14">
                            <template slot="prepend">系统名称</template>
                            <el-button slot="append" @click="saveName()">保存</el-button>
                        </el-input>
                    </div>
                    <div style="margin-bottom:25px;">
                        <el-form>
                            <el-form-item>
                                <el-input placeholder="请输入内容" v-model="phone" >
                                    <template slot="prepend">服务电话</template>
                                    <el-button slot="append" @click="sendMessage()">保存</el-button>
                                </el-input>
                            </el-form-item>
                        </el-form>
                    </div>
                    <!-- <div>
                        <el-input placeholder="请输入内容" v-model="registe" maxlength="32">
                            <template slot="prepend">系统注册</template>
                            <el-button slot="append" @click="zhuce()">注册</el-button>
                        </el-input>
                    </div> -->
                    <div class="upload">
                        <div class="logo">
                            <img :src="logoImg" alt="">
                        </div>
                        <div class="upload_sc">
                            <a href="javascript:;" class="file">上传LOGO
                                <input type="file" ref="fileBtn" @change="uploadImg2" />
                            </a>
                            <p style="margin-bottom: 10px;color: #e6a23c;font-size: 12px;margin-top:10px">*LOGO文件大小不可超过1.5M,像素180*60</p>
                        </div>
                        
                    </div>
                    <el-button type="primary"   @click="synctime()" style="width:90px;margin-top:20px;">时间同步</el-button>
                    <p class="zhushi" style="text-indent:0px;margin-top:0px;">*同步电脑时间与服务器的时间，避免数据对应时间错误,请在web电脑端同步</p>
                </el-card>
            </el-col>
            <el-col :span="12">
                 <el-card class="box-card" v-loading="loading"
                element-loading-text="拼命加载中"
                element-loading-spinner="el-icon-loading"
                element-loading-background="rgba(0, 0, 0, 0.6)" style="height:420px">
                    <div slot="header" class="clearfix" @click="offineClick()">
                        <span><i class="el-icon-menu"></i> 系统注册</span>
                    </div>
                    <div style="margin-bottom:25px;" class="syscode">
                        <el-form label-width="80px">
                            <el-form-item label="主机编码">
                                <el-input v-model="syscode" disabled ></el-input>
                            </el-form-item>
                        </el-form>
                        
                    </div>
                    <div style="margin-bottom:25px;">
                        <el-input placeholder="请输入内容" v-model="registe" >
                            <template slot="prepend">注册码</template>
                            <el-button slot="append" @click="zhuce()">注册</el-button>
                        </el-input>
                    </div>
                </el-card>
            </el-col>
        </el-row>
        <el-dialog 
            title="同步更改" 
            :visible.sync="autoDialogVisible"
            :append-to-body = 'true'
            :close-on-click-modal="false"
          width="35%"

        >
        <div class="offine_devset">
            <div class="offine_devset_top">
                <p class="offine_nr">自动组网ip网段是否同时更改?</p>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="saveLan(1)">仅更改Lan口</el-button>
                <el-button type="primary" @click="saveLan(2)">同步更改</el-button>
            </span>
        </div>
        </el-dialog>
        <el-dialog 
            title="功能设定修改" 
            :visible.sync="centerDialogVisible"
            :append-to-body = 'true'
            :close-on-click-modal="false"
          width="700px"

        >
        <div class="offine_devset">
            <el-form :model="layout1"  label-width="160px">
                <el-form-item label="设备累计时长:">
                    <span :class="layout1.devtimeshow == 1 ? 'offine_text':'offine_value'">不显示</span>
                    <el-switch
                        v-model="layout1.devtimeshow"
                        active-color="#13ce66"
                        inactive-color="#ff4949">
                    </el-switch>
                    <span :class="layout1.devtimeshow == 1 ? 'offine_value':'offine_text'">显示</span>
                </el-form-item>
                <el-form-item label="操作记录最大条数:">
                    <el-input v-model="layout1.editmax" type="number"></el-input>
                </el-form-item>
                <el-form-item label="历史报警记录最大条数:">
                    <el-input v-model="layout1.errormax" type="number"></el-input>
                </el-form-item>
                <el-form-item label="用户登录记录最大条数:">
                    <el-input v-model="layout1.loginmax" type="number"></el-input>
                </el-form-item>
                <el-form-item label="设备历史记录最大条数:">
                    <el-input v-model="layout1.valuemax" type="number"></el-input>
                </el-form-item>
                <p class="zhushi2">范围建议：
                        操作记录最大条数、历史报警记录最大条数、用户登录记录最大条数10万~50万条，设备历史记录最大条数10万~500万条。
                </p>
            </el-form>
            <div style="text-align: right;">
                <span slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="centerDialogVisible = false">取 消</el-button>
                    <el-button type="primary" @click="savelayout1()">保 存</el-button>
                </span>
            </div>
            
        </div>
        </el-dialog>
    </div>
</template>

<script>
//这里要俺需要引入，我不是一个对象
  import {isvalidPhone} from '../../assets/js/validate'
  
export default {
    data () {
          /*ip正则验证*/
        var validcodeip = (rule, value, callback) => {
            const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
            if (reg.test(value)) {
                callback();
            } else {
                return callback(new Error('输入格式不合法！'));
            }
        };
        return{
            centerDialogVisible: false,
            autoDialogVisible:false,
            offineC:0,
            offineValue:true,
            stime:0,
            layout0:{},
            layout1:{},
            systemName:'',
            msgip:'',
            wanForm: {
                ip:'',
                subnet:'',
                gateway:''

            },
            lanForm: {
                lanip:'',
                lansubnet:'',
                langateway:''

            },
            wifiForm: {
                name:'',
                pwd:''
            },
            systemName:'',
            registe:'',
            syscode:JSON.parse(localStorage.getItem('navbar')).syscode,
            phone:'',
            layout1:{
                devtimeshow:0,
                editmax:0,
                errormax:0,
                loginmax:0,
                valuemax:0
            },
            rules: {
                ip: [{validator:validcodeip,trigger:'blur'}],
                subnet: [{validator:validcodeip,trigger:'blur'}],
                gateway: [{validator:validcodeip,trigger:'blur'}],
                lanip: [{validator:validcodeip,trigger:'blur'}],
                lansubnet: [{validator:validcodeip,trigger:'blur'}],
                langateway: [{validator:validcodeip,trigger:'blur'}]
            },
            rules2: {
                name: [
                    { required: true, message: '请输入wifi名称', trigger: 'blur' },
                    { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }
                ],
                 pwd: [
                    { required: true, message: '请输入wifi密码', trigger: 'blur' },
                    { min: 6, max: 8, message: '长度在 6 到 8 个字符', trigger: 'blur' }
                ]
            },
            timeSysData:'',//接口方法的定时器
            sizenum:0,//时间计数
            repnum:3,//重复时间秒
            repeatnum:0,//失败访问次数
            timeGetData:'',//计时定时器
            loading:false,
            logoImg: '',
        }
    },
    created() {
        window.localStorage.removeItem('logo-base')
        if(localStorage.getItem('logo') == '{}' || localStorage.getItem('logo') == '' || localStorage.getItem('logo') == null || localStorage.getItem('logo') == undefined){
            this.logoImg = require('../../assets/logo.png')
        } else{
            this.logoImg = localStorage.getItem('logo')
        }
        this.getSystem()
        
    },
    methods: {
        // 弹出离线改变状态弹框 6秒之内点击5次
        offineClick() {
            this.offineC++;
            if (this.offineC > 4) {
                //打开ip弹框
                this.centerDialogVisible = true;
                this.offineC = 0;
                this.stime = 0
            }else if(this.offineC <= 4){
                if(this.stime == 0){
                    this.stime = 1
                    setTimeout(() => {
                        this.offineC = 0;
                        this.stime = 0
                    }, 6000);
                }
            }
        },
         numBlur(val){
            if(val == 1){
                //截取ip前三段
                var _str = this.wanForm.ip;
                var index = _str.lastIndexOf(".");
                _str = _str.substring(0, index);
                this.wanForm.gateway = _str + '.1'
                this.wanForm.subnet = '255.255.255.0'

            }else if(val == 2){
                //截取ip前三段
                var _str2 = this.lanForm.lanip;
                var index2 = _str2.lastIndexOf(".");
                _str2 = _str2.substring(0, index2);
                this.lanForm.langateway = _str2 + '.1';
                this.lanForm.lansubnet = '255.255.255.0'
            }    
        },
        //  WAN口保存函数
        saveWan() {
            console.log(this.wanForm.ip)
            this.layout0.ip0 = this.wanForm.ip;
            this.layout0.mask0 = this.wanForm.subnet;
            this.layout0.gw0 = this.wanForm.gateway;
            var arr = {
                "ip0":this.wanForm.ip,
                "mask0":this.wanForm.subnet,
                "gw0":this.wanForm.gateway
            }
            var params = {
                "setlayout":"layout0",
                "layout":arr,
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
            this.$http.post(this.$baseUrl, params).then((res) => {
                   if(res.data.result !== 'ok'){
                        this.$message({
                            message: '保存失败',
                            type: 'warning',
                            duration: 1500
                        });
                    }else{
                        this.$notify({
                            title: '保存成功',
                            type: 'success',
                            duration: 1500
                        });
                        this.getSystem()
                    }
            });
        },
        //  LAN口保存函数
        saveLan(val) {
            if(val == 0){
                this.autoDialogVisible = true
            }else{
                //截取ip前三段
                var _str = this.lanForm.lanip;
                var index = _str.lastIndexOf(".");
                var ipFirst = _str.substring(0, index); //lan口ip段
                // 短信猫ip截取
                // var _cat = this.msgip
                // var index2 = _cat.lastIndexOf(".");
                // var ipLast = _cat.substring(index2+1, _cat.length); //短信猫地址
                // 起始地址ip截取
                var _dhcpfip = this.layout0.dhcpfip
                var index3 = _dhcpfip.lastIndexOf(".");
                var dhcpfLast = _dhcpfip.substring(index3+1, _dhcpfip.length);
                // 终止地址ip截取
                var _dhcplip = this.layout0.dhcplip
                var index4 = _dhcplip.lastIndexOf(".");
                var dhcplLast = _dhcplip.substring(index4+1, _dhcplip.length);

                this.layout0.ip1 = this.lanForm.lanip;
                this.layout0.mask1 = this.lanForm.lansubnet;
                this.layout0.gw1 = this.lanForm.langateway;
                if(val == 1){ //不同步更改
                    var arr = {
                        "ip1":this.layout0.ip1,
                        "mask1":this.layout0.mask1,
                        "gw1":this.layout0.gw1,
                    }
                    var params = {
                        "setlayout":"layout0",
                        "layout":arr,
                        [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                    }
                    this.$http.post(this.$baseUrl, params).then((res) => {
                        this.autoDialogVisible = false
                        if(res.data.result == 'ok'){
                                this.$notify({
                                    title: '保存成功',
                                    type: 'success',
                                    duration: 1500
                                });
                                this.getSystem()
                                // if(this.layout0.dhcpenable == 0){
                                //     // 自动状态需要设备扫描
                                //     this.configIp()
                                // }
                            }else{
                                this.$message({
                                    message: '保存失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                            }
                    });
                }else if(val == 2){//同步更改
                    
                    // this.layout0.gsmlan = ipFirst+'.'+ipLast;
                    this.layout0.dhcpfip = ipFirst+'.'+dhcpfLast; //起始地址
                    this.layout0.dhcplip = ipFirst+'.'+dhcplLast; //终止地址
                    this.layout0.dhcpgw = ipFirst+'.1'; //子网掩码
                    var arr = {
                        "ip1":this.layout0.ip1,
                        "mask1":this.layout0.mask1,
                        "gw1":this.layout0.gw1,
                        // "gsmlan":this.layout0.gsmlan,
                        "dhcpfip":this.layout0.dhcpfip,
                        "dhcplip":this.layout0.dhcplip,
                        "dhcpgw":this.layout0.dhcpgw
                    }
                    var params = {
                        "setlayout":"layout0",
                        "layout":arr,
                        [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                    }
                    this.$http.post(this.$baseUrl, params).then((res) => {
                        this.autoDialogVisible = false
                        if(res.data.result == 'ok'){
                                this.$notify({
                                    title: '保存成功',
                                    type: 'success',
                                    duration: 1500
                                });
                                this.getSystem()
                                // if(this.layout0.dhcpenable == 0){
                                //     // 自动状态需要设备扫描
                                //     this.configIp()
                                // }
                            }else{
                                this.$message({
                                    message: '保存失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                            }
                    });
                }
            }
            

            
        },
        configIp(){
             // 接口访问失败逻辑循环：3秒无返回认定接口失败，并重新访问接口，接口访问成功后该方法自动重置
            var size;
            this.timeGetData = setInterval(() => {
                if(this.sizenum >= this.repnum){ //达到3000ms延迟等待结果未返回
                    clearInterval(this.timeGetData); //清除定时器
                    this.timeGetData = null; //清除定时器
                    this.sizenum = 0 //时间计数重置
                    if(size == undefined){ //接口没有拿到返回
                        this.$message({
                            message: '设备ip分配失败',
                            type: 'error',
                            duration: 1000
                        });
                        this.configIp() //重新访问接口
                    }
                }else{
                    this.sizenum++; //时间累计
                }
            }, 1000); 
            // -----------------------------
            // 设备扫描接口
            var params = {
                "devreset":0,//值随机，不做具体参数
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
            this.$http.post(this.$baseUrl, params).then((res) => {
                if(res.data.result !== 'ok'){
                    this.$message({
                        message: '设备ip分配失败',
                        type: 'error',
                        duration: 1000
                    });
                }else if(res.data.result == 'ok'){
                    // 接口失败重复逻辑相关
                    size = res.data.result;
                    // ----------------------
                    this.$message({
                        message: '设备ip分配完成',
                        type: 'success',
                        duration: 1000
                    });
                }
            });
        },
        //系统信息获取
        getSystem () {
            var ss = 0
             var params = {
                "getlayout":"layout0",
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
            this.$http.post(this.$baseUrl, params).then((res) => {
                if(res.data.result == 'ok'){
                    if(res.data.layout0 == undefined){
                        ss++
                    }else{
                        var data = res.data.layout0
                        this.layout0 = data
                        this.systemName = data.name;
                        this.wanForm.ip =  data.ip0;
                        this.wanForm.subnet =  data.mask0;
                        this.wanForm.gateway =  data.gw0;
                        this.lanForm.lanip =  data.ip1;
                        this.lanForm.lansubnet =  data.mask1;
                        this.lanForm.langateway =  data.gw1;
                        this.wifiForm.name = data.wifi; 
                        this.wifiForm.pwd = data.wifipwd; 
                        this.msgip = data.gsmlan;
                        this.phone =  data.servicephone
                    }
                }else if(res.data.result =='No access rights.'){
                }
                
            });
            var params2 = {
                "getlayout":"layout1",
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
            this.$http.post(this.$baseUrl, params2).then((res) => {
                if(res.data.layout1 == undefined){
                    ss++
                }else{
                    // 旧逻辑
                    // var data2 = JSON.parse(res.data.layout1)
                    // this.layout1 = data2
                    // 新逻辑
                    var data2 = res.data.layout1
                    this.layout1.devtimeshow = data2.devtimeshow == 1 ? true : false,//0不显示 1显示
                    this.layout1.editmax = data2.editmax
                    this.layout1.errormax = data2.errormax
                    this.layout1.loginmax = data2.loginmax
                    this.layout1.valuemax = data2.valuemax
                }
            })
            if(ss > 0){ //有失败接口
                // 停止循环接口
                clearInterval(this.timeSysData);
                this.timeSysData = null;
                this.$nextTick(() => {
                    this.timeSysData = setInterval(() => {
                        this.getSystem()
                    }, 3000); 
                })
            }else{
                // 停止循环接口
                clearInterval(this.timeSysData);
                this.timeSysData = null;
            }
        },
        // 系统名称保存
        saveName () {
            this.layout0.name = this.systemName;
            var arr = {
                "name":this.layout0.name
            }
            var params = {
                "setlayout":"layout0",
                "layout":arr,
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
            this.$http.post(this.$baseUrl, params).then((res) => {
                   if(res.data.result == 'ok'){
                        this.getSystem()
                        this.$notify({
                            title: '保存成功',
                            type: 'success',
                            duration: 1500
                        });
                        this.getSystem()
                    }else{
                        this.$message({
                            message: '保存失败',
                            type: 'warning',
                            duration: 1500
                        });
                    }
            });
        },
        // 服务电话保存
        sendMessage () {
            var params = {
                "setlayout":"layout0",
                "layout":{
                    "servicephone":this.phone
                },
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
            this.$http.post(this.$baseUrl, params).then((res) => {
                if(res.data.result !== 'ok'){
                }else{
                    this.$notify({
                        title: '保存成功',
                        type: 'success',
                        duration: 1500
                    });
                    localStorage.setItem("phone", this.phone)
                }
            })
                        
        },
        // 系统注册
        zhuce () {
            if(this.registe == ''){
                this.$notify({
                    title: '请输入注册码',
                    type: 'warning',
                    duration: 1500
                });
                return false
            }else{
                var params = {
                    "setlicense":this.registe,//注册码
                }
                this.$http.post(this.$baseUrl, params).then((res) => {
                    if(res.data.result == 'ok'){
                        this.$notify({
                            title: '发送成功',
                            type: 'success',
                            duration: 1500
                        });
                        setTimeout(()=>{
                        this.encryptVisible = false
                        this.license = ''
                        },1000)
                        
                    }else{
                        this.$notify({
                            title: '发送失败',
                            type: 'warning',
                            duration: 1500
                        });
                    }
                });
            }
            
        },
        uploadImg2() {
    			var that = this;
    			const inputFile = this.$refs.fileBtn.files[0];
    			let res;
    			console.log('选了图片');
                console.log(inputFile);
                this.loading = true
    			this.inputFile = inputFile;
    			if (this.inputFile) {
    				let inputFile = this.inputFile;
    				if (inputFile.type !== 'image/png') {
                        this.$notify({
                            title: '请选择png格式文件',
                            type: 'warning',
                            duration: 2000
                        });
                        this.loading = false
    					return;
    				}
    				this.imgInfo = Object.assign({}, this.imgInfo, {
    					name: inputFile.name,
    					size: inputFile.size,
    					lastModifiedDate: inputFile.lastModifiedDate.toLocaleString()
    				});
    				const reader = new FileReader();
    				res = reader.readAsDataURL(this.inputFile);
    				reader.onloadend = function() {
                        this.base =  reader.result.substring(0);
                        localStorage.setItem("logo-base", this.base)
    				};
    				reader.onload = function(e) {
    					console.log(e);
    					that.imgSrc = this.result;   // 注意:这里的this.result中,这个this不是vue实例,而是reader对象,所以之前用that接收vue示例  that.imgSrc   
                    };
                    setTimeout(() =>{
                        var params = {
                            "setlayout":"layout7",
                            "layout":localStorage.getItem('logo-base'),
                            [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
                        }
                        console.log(params)    

                        this.$http.post(this.$baseUrl, params).then((res) => {
                            console.log(res) 
                            if(res.data.result !== 'ok'){
                                // this.logoImg = require('../../assets/logo.png')
                                // localStorage.setItem("logo", '{}')
                                this.$notify({
                                    title: '上传失败',
                                    type: 'warning',
                                    duration: 1500
                                });
                            }else{
                                this.$notify({
                                    title: '上传成功',
                                    type: 'success',
                                    duration: 1500
                                });
                                localStorage.setItem("logo", localStorage.getItem('logo-base'))
                                this.logoImg = localStorage.getItem('logo')
                                setTimeout(()=>{
                                    location.reload() // 重新加载页面
                                },500)
                            }
                            this.loading = false
                        });
                        
                    },2000);

                     
    			} else {
    				return;
    			}
        },
        // 时间同步
         synctime(){
            // let time =  Date.parse(new Date())/1000;
            let time =  Date.parse(new Date())/1000;
            var params = {
                "settime":time,//时间戳，单位秒
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
             this.$http.post(this.$baseUrl, params).then((res) => {
                   if(res.data.result !== 'ok'){
                        this.$notify({
                            title: '同步成功失败',
                            type: 'warning',
                            duration: 1500
                        });
                    }else{
                        this.$notify({
                            title: '同步成功',
                            type: 'success',
                            duration: 1500
                        });
                    }
            });
        },
        //隐藏弹框保存
        savelayout1(){
            var arr = {
                "devtimeshow":this.layout1.devtimeshow == true ? 1 : 0,
                "editmax":Number(this.layout1.editmax),
                "errormax":Number(this.layout1.errormax),
                "loginmax":Number(this.layout1.loginmax),
                "valuemax":Number(this.layout1.valuemax)
            }
            var params = {
                "setlayout":"layout1",
                "layout":arr,
                [localStorage.getItem("cookieName")]:localStorage.getItem("_token")
            }
            this.$http.post(this.$baseUrl, params).then((res) => {
                   if(res.data.result !== 'ok'){
                    }else{
                        this.$notify({
                            title: '保存成功',
                            type: 'success',
                            duration: 1500
                        });
                        this.centerDialogVisible = false
                    }
            });
        },
    },
    beforeDestroy() {
        // 停止循环接口
        clearInterval(this.timeSysData);
        this.timeSysData = null;
        // 停止循环接口
        clearInterval(this.timeGetData);
        this.timeGetData = null;
    }
}
</script>

<style scoped>
 .el-card {
    background: none;
    color: #fff;
    border: 1px solid rgba(89, 129, 165, 0.4);
    }
    /deep/ .el-card__header {
    background: rgba(89, 129, 165, 0.2);

    border-bottom: none;
    }
    .box-card {
    /* overflow: hidden; */
    }
    .card_padding_chart{
    padding: 7px 0;
    }
    /deep/ .el-input__inner{
        background: rgba(255, 255, 255, 0);
        border: 1px solid rgba(255, 255, 255, 0.3);
        width: 100%;
        color: #fff;
    }
    /deep/ .el-form-item__label{
        color: #fff;
    }
    .zhushi{
        margin-top: -10px;
        margin-bottom: 10px;
        color: #e6a23c;
        font-size: 12px;
        text-indent: 80px;
    }
    .zhushi2{
        margin-top: -5px;
        color: #e6a23c;
        font-size: 12px;
        height: 40px;
    }
    /deep/.el-card {
        height: 370px;
    }
    /deep/ .el-input-group__prepend{
        background: rgba(89, 129, 165, 0.4);
        color:#fff;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    /deep/ .el-input-group__append{
        background:#409EFF;
        color:#fff;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    /deep/ .el-card__body{
        padding: 35px 60px 0px 60px !important;
    }
    /deep/ .el-button{
        background: rgba(89, 129, 165, 0.8);
        border: none;
    }
    
/deep/ .el-dialog__header .el-dialog__title {
  color: #fff !important;
}

/deep/ .el-dialog {
  background: rgba(79, 112, 151, 0.4) !important;
}
/deep/ .el-dialog__header {
  background: rgba(0, 0, 0, 0.2);
  color: #fff !important;
}
/deep/ .el-dialog__header .el-dialog__title {
  color: #fff !important;
}
/deep/ .el-form-item__label {
  color: #fff !important;
}
/deep/ .el-dialog__body{
        padding: 30px 135px 30px 40px;
}
    .offine_devset{
        /* text-align: center; */
        margin-left: 50px;
    }
    .offine_devset_top{
        margin-bottom: 40px;
        margin-top: 20px;
    }
    .offine_nr{
        font-size: 18px;
        color: #fff;
    }
    .offine_text{
        color: #c4c4c4;
    }
    .offine_value{
        color: #e6a23c;
    }
    /deep/ .el-radio__label{
        font-size: 16px !important;
        color: #fff;
    }
    .upload{
        height: 100px;
        position:relative;
        display: flex;
        align-items: center;
    }
    .upload_sc{
        padding-top: 20px;
        text-align: center;
    }
    .file {
        position: relative;
        overflow: hidden;
        display: inline-block;
        background: rgba(89, 129, 165, 0.6);
        border: 1px solid rgba(89, 129, 165, 0.6);
        border-radius: 4px;
        padding: 6px 20px;
        overflow: hidden;
        color: #fff;
        text-decoration: none;
        text-indent: 0;
        line-height: 28px;
    } 
    .file input {
        position: absolute;
        font-size: 100px;
        right: 0;
        top: 0;
        opacity: 0;
    }
    .logo{
        margin-right: 30px;
        height: 100px;
        width: 400px;
        border: 1px dashed #ffffff47;
        background: #7b7b7b1a;
        text-align: center;
    }
    .logo img{
        height: 100%;
    }
    /* license弹框 */
/deep/ .syscode .el-input.is-disabled .el-input__inner{
  background: #0000001f;
  border: 1px solid #ffffff4d;
  color: #fff;
}
</style>